<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{
            width: 100px;
            height: 200px;
            background-color: red;
        }
    </style>
</head>
<body>
    <div>

    </div>
    <script>
        var div = document.querySelector("div");
        // var x = div.getBoundingClientRect().x;
        // var y = div.getBoundingClientRect().y;
        // var w = div.getBoundingClientRect().width;
        // var h = div.getBoundingClientRect().height;

        var {x,y,width,height} = div.getBoundingClientRect();
        console.log(y);


        var obj = {
            name:"lili",
            age:18,
        }
        // var name = obj.name;
        // var age = obj.age;

        // 得到obj这个对象中name属性与age属性的值赋值给全局变量name与age
        // 变量名需要与属性名一样

        // var {age,name} = obj;
        // 给全局变量定义新的名称 (属性名:变量名) = 对象
        var {age:a,name:n} = obj;
        // console.log(n); //lili
        // console.log(a); //18


        var arr = [12,23,34,45,["a","b"]];
        // console.log(arr[2]);
        var [a,b,c,d,[e,f]] = arr;
        console.log(a);
        console.log(e);
    </script>
</body>
</html>